package com.zqx.spmab.dao;

import com.zqx.spmab.pojo.domain.Attachment;
import com.zqx.spmab.pojo.form.AttachmentForm;
import com.zqx.spmab.pojo.query.AttachmentQuery;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Created by Zqx on 2018/4/24.
 */
@Mapper
public interface AttachmentDao {

    /**
     * 查询 Attachment
     */
    List<Attachment> find(final AttachmentQuery query);

    /**
     * 通过id得到一个 Attachment
     */
    Attachment get(final String id);

    /**
     * 新增 Attachment
     */
    void add(final AttachmentForm form);

    /**
     * 修改 Attachment
     */
    int update(final AttachmentForm form);

    /**
     * 删除一个 Attachment
     */
    int delete(final String id);

    /**
     * 单文件上传，删除其他的
     */
    int deleteForOne(final AttachmentForm form);

    /**
     * 修改是否可用
     */
    int changeEnabled(@Param("id") final String id, @Param("enabled") final Integer enabled);
}
